//
//  WarmTableViewCell.m
//  LFCWarmSystem
//
//  Created by Kill on 16/4/27.
//  Copyright © 2016年 李福才. All rights reserved.
//

#import "WarmTableViewCell.h"

@implementation WarmTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}






- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(nullable NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        _btnLeftUp = [UIButton buttonWithType:UIButtonTypeCustom];
        _btnLeftUp.titleLabel.font = TABLECELLTEXTSMALLFONT;
        [_btnLeftUp setTitleColor:BLACKCOLOR forState:UIControlStateNormal];
        _btnLeftUp.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        [self addSubview:_btnLeftUp];
        
        _btnLeftDown = [UIButton buttonWithType:UIButtonTypeCustom];
        _btnLeftDown.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _btnLeftDown.titleLabel.font = TABLECELLTEXTSMALLFONT;
        [_btnLeftDown setTitleColor:BLACKCOLOR forState:UIControlStateNormal];
        [self addSubview:_btnLeftDown];
        
        
        _btnLeft = [UIButton buttonWithType:UIButtonTypeCustom];
        _btnLeft.titleLabel.font = TABLECELLTEXTFONT;
        [_btnLeft setTitleColor:TEXTCOLOR forState:UIControlStateNormal];
        _btnLeft.layer.borderWidth = 1.0;
        _btnLeft.layer.borderColor = (__bridge CGColorRef _Nullable)([UIColor whiteColor]);
        [self addSubview:_btnLeft];
        [_btnLeft setHidden:YES];
        
        _lblLeft = [[UILabel alloc] init];
        [self addSubview:_lblLeft];
        _lblLeft.hidden = YES;
        _lblLeft.hidden = YES;
        _lblLeft.font = TABLECELLTEXTFONT;
        _lblLeft.textAlignment = NSTextAlignmentCenter;
        _lblLeft.textColor = TEXTCOLOR;
        
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = BACKGROUNDVIEWCOLOR;
        [self addSubview:_lineView];
        _lineView.hidden = YES;
        
        _btnRight = [UIButton buttonWithType:UIButtonTypeCustom];
        _btnRight.titleLabel.font = TABLECELLTEXTFONT;
        [_btnRight setTitleColor:TEXTCOLOR forState:UIControlStateNormal];
        [self addSubview:_btnRight];
        
        _lblRight = [[UILabel alloc] init];
        [self addSubview:_lblRight];
        _lblRight.font = TABLECELLTEXTFONT;
        _lblRight.textAlignment = NSTextAlignmentCenter;
        _lblRight.textColor = TEXTCOLOR;
        
        self.backgroundColor = TABLEVIEWCOLOR;
    }
    return self;
}


- (void)setFrame:(CGRect)frame {
    [super setFrame:frame];
    if (_btnLeftUp) {
        _btnLeftUp.frame = CGRectMake(20*WIDTHSCALE, frame.size.height*3/8.0, frame.size.height/4.0, frame.size.height/8.0);
//        _btnLeftUp.titleEdgeInsets = UIEdgeInsetsMake(-frame.size.height/8.0, 0, frame.size.height/4.0, -80);
         _btnLeftDown.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _btnLeftUp.contentEdgeInsets = UIEdgeInsetsMake(-frame.size.height/8.0,0,frame.size.height/8.0,-80);
        
        _btnLeftDown.frame = CGRectMake(20*WIDTHSCALE, frame.size.height*5/8.0, frame.size.height/4.0, frame.size.height/8.0);
        _btnLeftDown.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _btnLeftDown.contentEdgeInsets = UIEdgeInsetsMake(-frame.size.height/8.0, 0, frame.size.height/8.0, -80);

        
        _btnLeft.frame = CGRectMake(0.0, 0.0, frame.size.width/2.0, frame.size.height);
        _btnLeft.imageEdgeInsets = UIEdgeInsetsMake(frame.size.height/4.0, frame.size.width/4.0-frame.size.height/8.0, frame.size.height/2.0, frame.size.width/4.0-frame.size.height/8.0);
        _btnLeft.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        _btnLeft.titleLabel.center = _btnLeft.center;
        _btnLeft.titleEdgeInsets =  UIEdgeInsetsMake(10.7*WIDTHSCALE, -36*WIDTHSCALE, -frame.size.height/4.0,36);
        
        _btnRight.frame = CGRectMake(frame.size.width/2.0, 0.0, frame.size.width/2.0, frame.size.height);
        _btnRight.imageEdgeInsets = _btnLeft.imageEdgeInsets;
        _btnRight.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        _btnRight.titleLabel.center = _btnRight.center;
        _btnRight.titleEdgeInsets =  _btnLeft.titleEdgeInsets;
        
        _lineView.frame = CGRectMake((frame.size.width-1)/2.0, 0.0, 1, frame.size.height);
        
        _lblLeft.frame = CGRectMake(0.0, frame.size.height/2.0, frame.size.width/2.0, frame.size.height/4.0);
        _lblRight.frame = CGRectMake(frame.size.width/2.0, frame.size.height/2.0, frame.size.width/2.0, frame.size.height/4.0);
        
    }
}

@end
